Fix dev env port resolution and improve multi-worktree support#2025
Fix dev env port resolution and improve multi-worktree support#2025kodiakhq[bot] merged 2 commits intomainfrom
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review
✅ The core fixes (self-referential |
E2E Test Results✅ All tests passed • 126 passed • 3 skipped • 1066s
Tests ran across 4 shards in parallel. |
05b38b1 to
ecc0664
Compare
ecc0664 to
db6ed84
Compare
db6ed84 to
b115a2d
Compare
| const sess: session.SessionOptions & { cookie: session.CookieOptions } = { | ||
| // Use a slot-specific cookie name in dev so multiple worktrees on localhost | ||
| // don't overwrite each other's session cookies. | ||
| ...(config.IS_DEV && process.env.HDX_DEV_SLOT |
There was a problem hiding this comment.
to avoid cookie session conflicts on localhost
Fix OTel collector endpoint resolution and add multi-worktree improvements:
- Fix dotenv-expand infinite recursion from self-referential ${VAR:-default}
patterns in .env files that prevented port isolation from working
- Fix HDX_COLLECTOR_URL fallback for browser-side OTel telemetry
- Set correct HYPERDX_API_KEY in app .env.development
- Add slot-specific session cookie names (connect.sid.<slot>) so multiple
worktrees on localhost don't overwrite each other's sessions
- Share NX build cache across worktrees via NX_CACHE_DIRECTORY
- Add worktrunk project config (.config/wt.toml) for worktree lifecycle
hooks: symlink node_modules, copy .env.local, clean up Docker on remove
b115a2d to
77a5dcf
Compare
Summary
Changes
Port resolution fix
Root
.env: Replace self-referentialHDX_DEV_*vars (e.g.HDX_DEV_OTEL_HTTP_PORT=${HDX_DEV_OTEL_HTTP_PORT:-4318}) with plain default values. The${VAR:-default}syntax causeddotenv-expandinfinite recursion, preventingdev-env.shport overrides from taking effect.packages/api/.env.development: Remove redundant self-referential port declarations and:-defaultfallbacks from${HDX_DEV_*}references. Ports now come exclusively fromdev-env.shexports or root.envdefaults.packages/app/.env.development: SetHYPERDX_API_KEYtosuper-secure-ingestion-api-key(matching the API/collector) instead of a placeholder. Remove self-referential port declarations.packages/app/src/config.ts: Addprocess.env.OTEL_EXPORTER_OTLP_ENDPOINTas fallback forHDX_COLLECTOR_URLso the browser OTel SDK picks up the correct collector endpoint.Session cookie isolation
packages/api/src/api-app.ts: Useconnect.sid.<slot>as the session cookie name in dev mode so multiple worktrees onlocalhostmaintain independent sessions. Guarded behindconfig.IS_DEV && process.env.HDX_DEV_SLOT— production uses the defaultconnect.sid.Shared NX build cache
scripts/dev-env.sh: SetNX_CACHE_DIRECTORY=~/.config/hyperdx/nx-cacheso all worktrees share a single content-hash-based build cache. Unchanged packages get cache hits regardless of worktree; changed packages rebuild correctly.Worktrunk project config
.config/wt.toml: New project config for worktrunk (wt) worktree lifecycle hooks:pre-start: Symlinknode_modules/from primary worktree (instant, no copy)post-start: Copy.env.localfrom primary worktreepost-remove: Tear down Docker stacks (dev-down,dev-int-down,dev-e2e-down) for the removed worktree's slot